#!/usr/bin/env perl

my $HOUR_IN_SECONDS = 60 * 60;
my $DAY_IN_SECONDS = 24 * $HOUR_IN_SECONDS;
my $WEEK_IN_SECONDS = 7 * $DAY_IN_SECONDS;
my $MONTH_IN_SECONDS = $DAY_IN_SECONDS * 30.4368499;
my $YEAR_IN_SECONDS = 31,556,926;

my $YESTERDAY = time-$DAY_IN_SECONDS;
my $LAST_WEEK = time-$WEEK_IN_SECONDS;
my $LAST_MONTH = time-$MONTH_IN_SECONDS;
my $LAST_YEAR = time-$YEAR_IN_SECONDS;

sub timestamp_range {
	my $begin = shift;	# initial timestamp
	my $end = shift;	# final timestamp
	my $step = shift;	# step in seconds
	my @stamps;
	for (my $stamp = $begin; $stamp <= $end; $stamp += $step) {
		push @stamps, $stamp;
	}
	return @stamps;
}